def get_breadcrumb(category):
    '''面包屑数据'''
    breadcrumb = dict(
        cat1='',
        cat2='',
        cat3=''
    )

    # 判断category是不是一级数据
    if category.parent is None:
        # 是一级数据
        breadcrumb['cat1'] = category.name

    elif category.subs.count() == 0:
        # 是三级分类
        breadcrumb['cat3'] = category.name
        breadcrumb['cat2'] = category.parent.name
        breadcrumb['cat1'] = category.parent.parent.name

    else:
        # 是二级分类
        breadcrumb['cat2'] = category.name
        breadcrumb['cat1'] = category.parent.name

    return breadcrumb